package com.daoeping.data;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bsc_address entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "bsc_address", catalog = "daoeping")
public class Bsc_address implements java.io.Serializable {

	// Fields

	private Integer id;
	private Bsc_city bsc_city;
	private String address;
	private String zipCode;
	private Set<Usr_userbasicinfo> usr_userbasicinfosForRegisteredAddressId = new HashSet<Usr_userbasicinfo>(
			0);
	private Set<Usr_userbasicinfo> usr_userbasicinfosForLiveAddressId = new HashSet<Usr_userbasicinfo>(
			0);
	private Set<Cop_contactref> cop_contactrefs = new HashSet<Cop_contactref>(0);

	// Constructors

	/** default constructor */
	public Bsc_address() {
	}

	/** minimal constructor */
	public Bsc_address(Bsc_city bsc_city) {
		this.bsc_city = bsc_city;
	}

	/** full constructor */
	public Bsc_address(Bsc_city bsc_city, String address, String zipCode,
			Set<Usr_userbasicinfo> usr_userbasicinfosForRegisteredAddressId,
			Set<Usr_userbasicinfo> usr_userbasicinfosForLiveAddressId,
			Set<Cop_contactref> cop_contactrefs) {
		this.bsc_city = bsc_city;
		this.address = address;
		this.zipCode = zipCode;
		this.usr_userbasicinfosForRegisteredAddressId = usr_userbasicinfosForRegisteredAddressId;
		this.usr_userbasicinfosForLiveAddressId = usr_userbasicinfosForLiveAddressId;
		this.cop_contactrefs = cop_contactrefs;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "city_id", nullable = false)
	public Bsc_city getBsc_city() {
		return this.bsc_city;
	}

	public void setBsc_city(Bsc_city bsc_city) {
		this.bsc_city = bsc_city;
	}

	@Column(name = "address", length = 500)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "zip_code", length = 32)
	public String getZipCode() {
		return this.zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bsc_addressByRegisteredAddressId")
	public Set<Usr_userbasicinfo> getUsr_userbasicinfosForRegisteredAddressId() {
		return this.usr_userbasicinfosForRegisteredAddressId;
	}

	public void setUsr_userbasicinfosForRegisteredAddressId(
			Set<Usr_userbasicinfo> usr_userbasicinfosForRegisteredAddressId) {
		this.usr_userbasicinfosForRegisteredAddressId = usr_userbasicinfosForRegisteredAddressId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bsc_addressByLiveAddressId")
	public Set<Usr_userbasicinfo> getUsr_userbasicinfosForLiveAddressId() {
		return this.usr_userbasicinfosForLiveAddressId;
	}

	public void setUsr_userbasicinfosForLiveAddressId(
			Set<Usr_userbasicinfo> usr_userbasicinfosForLiveAddressId) {
		this.usr_userbasicinfosForLiveAddressId = usr_userbasicinfosForLiveAddressId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bsc_address")
	public Set<Cop_contactref> getCop_contactrefs() {
		return this.cop_contactrefs;
	}

	public void setCop_contactrefs(Set<Cop_contactref> cop_contactrefs) {
		this.cop_contactrefs = cop_contactrefs;
	}

}